home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
ada
/
ada_lrm3.zip
/
LR7VT.SRC
< prev
next >
Wrap
Text File
|
1989-03-30
|
52KB
|
1,512 lines
-- ON-LINE Ada LANGUAGE REFERENCE MANUAL
-- Developed at Nofolk State University
-- Development funded by a grant from the U. S. Army
-- Project ReDTEA
-- Version 1.0 released December 1988
-- Programmer: Esther M. Lumsdon
-- Project Director: George C. Harrison, PhD
with TEXT_IO; use TEXT_IO;
with MACHINE_SPECIFIC; use MACHINE_SPECIFIC;
with LRM_TYPES; use LRM_TYPES;
with LRM_GLOBAL; use LRM_GLOBAL;
with STARLET; use STARLET;
with SMG; use SMG;
package LRM_SMG is
ANNEX_MENU_DISPLAY : LONGWORD_UNSIGNED;
CHAPTER_MENU_DISPLAY : LONGWORD_UNSIGNED;
KB_ID : LONGWORD_UNSIGNED;
LEFT_MOST : NATURAL;
-- X coordinate of where to paste virtual displays
-- dependent on whether they have borders or not.
LIMITED_BORDERS : BOOLEAN;
-- true if user doesn't want border on every window.
MAIN_MENU_CHOICE : STRING(1 .. 4);
MAIN_MENU_DISPLAY : LONGWORD_UNSIGNED;
RESULTANT_FILE : STRING(1 .. 10);
SIZE_COLUMNS : LONGWORD_SIGNED;
SIZE_ROWS : LONGWORD_SIGNED;
-- # of rows and columns available on user's terminal
TERM_ID : LONGWORD_UNSIGNED;
-- id assigned to user's terminal (pasteboard)
TEXT_SCREEN_DISPLAY : LONGWORD_UNSIGNED;
TOP_MOST : NATURAL;
-- X coordinate of where to paste virtual displays
-- dependent on whether they have borders or not.
USING_DEC_TERMINAL : BOOLEAN;
-- true if using DEC or compatible terminal (capable of obeying SMG$
-- VAX VMS system calls); false otherwise.
VD_2_ID : LONGWORD_UNSIGNED;
-- prompt and error message box
procedure INITIALIZE;
procedure WELCOME(IN_FILE_NAME : in STRING);
procedure DISPLAY_EXPLAIN(IN_FILE_NAME : in STRING);
procedure DISPLAY_MAIN_MENU(IN_FILE_NAME : in STRING);
procedure SELECT_FROM_MAIN_MENU(MAIN_MENU_CHOICE : out STRING);
procedure SCROLL_TEXT(IN_FILE_NAME : in STRING;
SAVE_TITLE : in STRING;
SAVE_FILE : in out FILE_TYPE);
procedure DO_CHAPTER_MENU(SAVE_FILE : in out FILE_TYPE);
procedure DO_ANNEX_MENU(SAVE_FILE : in out FILE_TYPE);
procedure CREDITS(SAVE_FILE : in out FILE_TYPE);
procedure TERMINATE_LRM;
end LRM_SMG;
-----------------------------------------------------------------
with TEXT_IO; use TEXT_IO;
with LRM_TYPES; use LRM_TYPES;
with LRM_GLOBAL; use LRM_GLOBAL;
with STARLET; use STARLET;
with SMG; use SMG;
with INT_IO; use INT_IO;
package body LRM_SMG is
procedure DISPLAY_MENU(IN_FILE_NAME : in STRING;
DISPLAY_ID : in LONGWORD_UNSIGNED) is
-- read menu text from file, and put entire file on screen.
EMPTY_STRING_80 : STRING(1 .. 80);
LAST_CHAR : NATURAL := 0;
READ_IN_FILE : FILE_TYPE;
READ_IN_LINE : STRING(1 .. 80);
begin
for I in 1 .. 80 loop
EMPTY_STRING_80 := (others => ' ');
end loop;
OPEN(READ_IN_FILE, IN_FILE, IN_FILE_NAME);
while not END_OF_FILE(READ_IN_FILE) loop
READ_IN_LINE := EMPTY_STRING_80;
GET_LINE(READ_IN_FILE, READ_IN_LINE, LAST_CHAR);
PUT_LINE(DISPLAY_ID => DISPLAY_ID, TEXT => READ_IN_LINE);
end loop;
end DISPLAY_MENU;
------------------------------------------------------------------------------
procedure DISPLAY_CHAPTER_MENU(IN_FILE_NAME : in STRING) is
-- read menu text from file, and put entire file on screen.
EMPTY_STRING_80 : STRING(1 .. 80);
LAST_CHAR : NATURAL := 0;
READ_IN_FILE : FILE_TYPE;
READ_IN_LINE : STRING(1 .. 80);
begin
EMPTY_STRING_80 := (others => ' ');
OPEN(READ_IN_FILE, IN_FILE, IN_FILE_NAME);
SET_CURSOR_ABS(CHAPTER_MENU_DISPLAY, 3, 1);
while not END_OF_FILE(READ_IN_FILE) loop
READ_IN_LINE := EMPTY_STRING_80;
GET_LINE(READ_IN_FILE, READ_IN_LINE, LAST_CHAR);
PUT_LINE(DISPLAY_ID => CHAPTER_MENU_DISPLAY, TEXT => READ_IN_LINE);
-- VMS 5.0 put_line (display_id => chapter_menu_display, text
-- => read_in_line, flags => smg$m_wrap_word);
end loop;
end DISPLAY_CHAPTER_MENU;
------------------------------------------------------------------------------
procedure INITIALIZE is
-- Initialization for on-line Ada Language Reference Manual
-- using SMG$ virtual terminal driver
--
--
--LOGIC:
--
-- Decide terminal category
-- Prompt user for value of limited_borders
-- create pasteboard
-- create bordered box for prompts ( 1 rows x 78 columns @20,2), the
-- annex_menu_display, chapter_menu_display, main_menu_display;
-- most of these are 18 rows x 78 columns, paste @2,2.
--
-- create virtual keyboard for user input
-- attach virtual keyboard to user device
--
BORDER_CHOICE : CHARACTER := 'y';
OD : CHAR_STRING(1 .. 10); -- output device
PSF : MASK_LONGWORD; -- Preserve Screen Flag (in SMG$)
----------------------------------------------------------------------------
procedure DECIDE_TERM_CATEGORY(USING_DEC_TERMINAL : out BOOLEAN) is
CHOSE_TERMINAL_CATEGORY : BOOLEAN;
TERM_CATEGORY : CHARACTER;
begin
loop
CLS;
PUT_LINE(" The following terminals are available for your use at NSU:")
;
PUT_LINE("Category A terminals:");
PUT_LINE(" VISUAL brand terminals");
PUT_LINE(" TeleVideo brand terminals");
PUT_LINE(" DEC terminals");
NEW_LINE;
PUT_LINE("Category B terminals:");
PUT_LINE(" ADM brand terminals");
PUT_LINE(" Adds-Viewpoint terminals");
PUT_LINE(" Hazeltine brand terminals");
NEW_LINE(2);
PUT(
"Please enter A or B for the category of terminal that you are using: "
);
GET(TERM_CATEGORY);
CHOSE_TERMINAL_CATEGORY := TRUE;
case TERM_CATEGORY is
when 'A' | ASCII.LC_A =>
USING_DEC_TERMINAL := TRUE;
when 'B' | ASCII.LC_B =>
USING_DEC_TERMINAL := FALSE;
when others =>
CHOSE_TERMINAL_CATEGORY := FALSE;
end case;
exit when CHOSE_TERMINAL_CATEGORY;
end loop;
end DECIDE_TERM_CATEGORY;
-----------------------------------------------------------------
begin
-- create annex_menu_display, chapter_menu_display, main_menu_display,
-- text_screen_display
CLS;
USING_DEC_TERMINAL := TRUE;
if USING_DEC_TERMINAL then
NEW_LINE(2);
PUT_LINE("Do you want windows with borders, or without borders?");
PUT(
"If you are accessing this system at slower than 4800 baud, your screen"
);
NEW_LINE;
PUT_LINE(" will update much faster without borders.");
NEW_LINE;
PUT("Do you want borders (y/n) ? ");
GET(BORDER_CHOICE);
if (BORDER_CHOICE = 'n' or BORDER_CHOICE = 'N') then
LIMITED_BORDERS := TRUE;
SCREEN_HEIGHT := 19;
else
LIMITED_BORDERS := FALSE;
SCREEN_WIDTH := SCREEN_WIDTH - 2;
SCREEN_HEIGHT := 18;
end if;
OD := "SYS$OUTPUT";
-- set psf=0
PSF := 0;
CREATE_PASTEBOARD(TERM_ID, OD, SIZE_ROWS, SIZE_COLUMNS, PSF);
CREATE_VIRTUAL_KEYBOARD(NEW_KEYBOARD_ID => KB_ID, RESULTANT_FILESPEC =>
RESULTANT_FILE);
if LIMITED_BORDERS then
TOP_MOST := 1;
LEFT_MOST := 1;
else
TOP_MOST := 2;
LEFT_MOST := 2;
end if;
if LIMITED_BORDERS then
CREATE_VIRTUAL_DISPLAY(NUM_ROWS => 25, NUM_COLUMNS => 80, NEW_DISPLAY_ID
=> CHAPTER_MENU_DISPLAY);
else
CREATE_VIRTUAL_DISPLAY(22, 78, CHAPTER_MENU_DISPLAY, SMG_M_BORDER);
end if;
if LIMITED_BORDERS then
CREATE